#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;
vector<int> arr;
ll n,l,r;
ll dp(int x)
{
	int left=0,right=0;
	ll ret=0;
	while(right<arr.size())
	{
		while(arr[right]-arr[left]>x)
			left++;
		ret+=right-left;
		right++;
	}
	return ret;
}
int main()
{
	
	cin>>n>>l>>r;
	arr.resize(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	
	sort(arr.begin(),arr.end());
	cout<<dp(r)-dp(l-1)<<endl;
	
	return 0;
}
//l+aj<=ai<=r+aj
